package srdb.migration.dbhandler.db2;

import java.io.FileInputStream;
import java.sql.DriverManager;
import java.util.Properties;

import srdb.migration.Util.DBInfo;
import srdb.migration.common.MTKConnection;

public class Db2Connection extends MTKConnection {
	private static String driver = "com.ibm.db2.jcc.DB2Driver";

	public Db2Connection(String dbURL, String dbUser, String dbPassword)
			throws Exception {
		super(dbURL, dbUser, dbPassword);
		Class.forName(driver).newInstance();
		// String url = "jdbc:db2://192.168.159.129:50000/test01";
		this.conn = DriverManager.getConnection(dbURL, dbUser, dbPassword);

	}

	public Db2Connection(String PropertiesFile) throws Exception {
		super(PropertiesFile);
		Properties ini = new Properties();
		ini.load(new FileInputStream(PropertiesFile));

		this.dbURL = ini.getProperty("Db2Connection");
		this.dbUser = ini.getProperty("Db2User");
		this.dbPassword = ini.getProperty("Db2Password");
		Class.forName(driver).newInstance();
		this.conn = DriverManager.getConnection(dbURL, dbUser, dbPassword);
	}


	@Override
	public boolean preConnectDB(String[] parms) throws Exception {
		//todo
		return false;
	}
}
